Attribute VB_Name = "modODBCBombardierAero"
'---------------------------------------------------------------------------------------
'Module     : modODBC
'Date       : 05/18/2004
'Updated    : 02/21/2005
'Author     : Chris Elwell
'Purpose    : This is an example of a CIC integration module. This is for demostration
'           purposes only. You must write the code required to get/writeback data from/to
'           your customer's data source.
'
'           This example uses the FSMSClientTest.mdb. A DSN is setup as FSMSClientTest.
'           Regardless of the integration method, CICs must have a module that contains
'           specific sub routines. All of these subs/functions listed below must exist
'           as they are called from the main program.
'           Public Function GetData(ByVal strKey As String) As Boolean - this routine is
'               called when the Order ID field loses focus. This is where you would code to
'               get order data from a customer and populate the screen fields. You can create
'               and call as many support routines as necessary. Also, this routine should
'               return a boolean True if getting the order data was succesful and a boolean
'               False if it was not.
'           Public Sub WriteReply() - this is called after a successful shipment. A typical
'               use would be to write FXRS reply data back to a customer's system, but can be
'               used for anything that you want to have happen after a pckage is shipped.
'           Public Sub WriteError() - this is called after an error is returned from FXRS.
'           Public Sub WriteDelete(ByVal strTracking As String) - this is called after a
'               package is successfully deleted.
'           Public Sub AfterClose() - this is called after FXRS is closed.
'           Public Sub BeforeClose() - this is called just before an FXRS close transaction
'               is sent.
'Updated:   Public Function BeforeShip() - Return TRUE to continue shipment, False to cancel.
'           Public Sub Initialize() - this is called once on program execution.
'           Public Sub BeforeBatch() - this is called before processing a batch file.
'           Public Sub BeforeBatchShip() - this is called before each individual batch transaction.
'New:       Public Sub AfterAddrLookup() - this is called after cboCustID, cboContact, and cboCompany lose focus
'New:       Public Sub AfterDeptLostFocus() - this is called after cboDept or f38 loses focus.
'
'2005-04-20, JFW, Added AddDSN for integration database.
'2005-08-24, JFW, Pratt & Whitnet required field f1222 pre-assigned tracking number.
'2009-04-16, JFW, Server is changing reversing USD and CAD
'---------------------------------------------------------------------------------------


Option Explicit


#If BombardierAero Then

Dim m_CN As ADODB.Connection
Dim m_RS As ADODB.Recordset
Dim m_strLine As String

Dim boolB13A As Boolean


'2/8/05 - API function declaration to add DSN to system used in AddDSN() function.
Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" (ByVal _
   hwndParent As Long, ByVal fRequest As Long, ByVal _
   lpszDriver As String, ByVal lpszAttributes As String) As Long
   
   
'---------------------------------------------------------------------------------------
' Procedure : AddDSN
' DateTime  : 2/8/2005
' Purpose   : Adds the FSMSClient v720.3 DSN
' Call from : Form_Load
'---------------------------------------------------------------------------------------
'
Private Function AddDSN() As Boolean
    On Error GoTo EH
    
    Dim ret As Long
    Dim Driver As String
    Dim Attributes As String
    
    Driver = "Microsoft Access Driver (*.mdb)"
    Attributes = Attributes & "DBQ=" & App.Path & "\FSMSClientTest.mdb" & Chr(0)
    Attributes = Attributes & "DSN=FSMSClientTest" & Chr(0)
    Attributes = Attributes & "DESCRIPTION=FSMS Client Test Automatic DSN Creation" & Chr(0)

  
    ret = SQLConfigDataSource(0, 4, Driver, Attributes)
   
    If ret <> 1 Then
        AddDSN = False
    Else
        AddDSN = True
    End If

    Exit Function
EH:
    AddDSN = False

End Function


'---------------------------------------------------------------------------------------
' Procedure : GetData()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Called from frmShip.f1_LostFocus, which is the OrderID field.
'             Call routines needed to get data from the customer's system and assign the
'             value to the appropriate fields on the Ship form. This example uses ODBC.
'---------------------------------------------------------------------------------------
'
Public Function GetData(ByVal strKey As String) As Boolean
    On Local Error GoTo Handler
    Dim strSelect As String
    Dim strUserPwd As String    'DSN user and password separated by ','
    Dim strUser As String       'DSN user name
    Dim strPwd As String        'DSN user password

    strSelect = "SELECT * FROM Customers WHERE OrderID = '" & strKey & "'"

    If Not Connect Then Exit Function   'set conection and recordset

    m_RS.CursorLocation = adUseClient
    m_RS.Open strSelect, m_CN, adOpenStatic     'run SELECT

    Set m_RS.ActiveConnection = Nothing
    m_CN.Close

    If m_RS.BOF And m_RS.EOF Then
        'No records found for that order number
        m_RS.Close
        GetData = False
        Exit Function
    End If
    'Example use of SetCurrentAccount to programmatically change the current shipping account
'    If Not SetCurrentAccount(m_RS!AcctNum) Then
'        MsgBox "Account not found. Please select account from Location box", vbExclamation, "Error"
'    End If

    With frmShip
        .f12.Text = m_RS!Contact & ""
        .f11.Text = m_RS!Company & ""
        .f13.Text = m_RS!Addr1 & ""
        .f14.Text = m_RS!Addr2 & ""
        .f15.Text = m_RS!City & ""
        .f16.Text = m_RS!State & ""
        .f17.Text = m_RS!Zip & ""
        .f18.Text = m_RS!Phone & ""
        .f50.Text = m_RS!Country & ""
        .f1274.Text = m_RS!Service & ""
        .f1273.Text = m_RS!Packaging & ""
        .f116.Text = m_RS!NumPkgs & ""

'        Example 1 Optimization test - assume we know know weight and del date
'        .f1670 = "1"
'        .txtDelDate = Date + 2
'        Set optimization flag to true and call QuoteConnect
'        g_blnDoOptimize = True
'        Call .QuoteConnect

        .f1670.SetFocus 'Set focus to read scale
    End With

    'Example use of the SetMessage sub
'    Call SetMessage("Destination state is: " & m_RS!State, 16, vbBlack, True)

    GetData = True
Release:
    Call Kill
    Exit Function
Handler:
    MsgBox Err.Description, , "modODBC.SQLSelect"
    Resume Release
    
'    If strKey = "Batch" Then
'        Dim FSO As New Scripting.FileSystemObject
'        Dim fsoFileIn As Scripting.TextStream
'
'        'Show the Batch commondialog and open selected file
'        With frmShip
'            .cdlBatchFilename.ShowOpen
'            Set fsoFileIn = FSO.OpenTextFile(.cdlBatchFilename.FileName, 1)
'        End With
'
'        'Loop through all the lines in the file until complete
'        Do While Not fsoFileIn.AtEndOfStream
'
'            g_blnComplete = False
'
'            m_strLine = fsoFileIn.ReadLine
'            Call PopulateShipScreen(m_strLine)
'
'            Do While Not g_blnComplete
'                DoEvents
'            Loop
'
'        Loop
'    Else
'        'Normal interactive code
'    End If

End Function

'Public Sub PopulateShipScreen(ByVal strLine As String)
'
'    Dim strFields() As String
'
'    strFields = Split(strLine, ",")
'
'    With frmShip
'        .f1 = strFields(0)
'        .f12 = strFields(1)
'        .f11 = strFields(2)
'        .f13 = strFields(3)
'        .f14 = strFields(4)
'        .f15 = strFields(5)
'        .f16 = strFields(6)
'        .f17 = strFields(7)
'        .f18 = strFields(8)
'        .f25 = strFields(9)
'        .f1670 = strFields(10)
'        .f1274 = strFields(11)
'    End With
'
'End Sub


'---------------------------------------------------------------------------------------
' Procedure : WriteReply()
' DateTime  : 2/14/2005
' Purpose   : REQUIRED SUB. Called after a successful ship transaction.
'             This example shows how to obtain multiple occurrence fields from the
'             FXRS reply and how to obtain multiple occurrence fields included in the
'             input transaction but not returned in the FXRS reply.
'---------------------------------------------------------------------------------------
'
Public Sub WriteReply()
    
    On Local Error GoTo Handler
    
    Dim i As Integer
    Dim j As Integer
    
    Dim f1 As String                    'OrderID (in TransID field)
    Dim f35 As String                   'Total surcharges
    Dim f37 As String                   'Net charge
    Dim f60 As String                   'Billed weight
    Dim f116 As String                  'Num pkgs
    Dim strInsert As String             'SQL INSERT
    Dim strMPS As String                'MPS SELECT query
    Dim rsMPS As New ADODB.Recordset    'Used to capture MPS input fields
    
    ' Clear B13A warning delivered
    boolB13A = False

    If Not Connect Then Exit Sub
    
    'Declare string arrays for trk numbers and declared values
    Dim str29() As String
    Dim str26() As String
    
    Dim intNumPkgs As Integer

    'Get number of pkgs
    intNumPkgs = Val(frmShip.f116)
    
    'ReDim the string array using the number of pkgs
    ReDim str29(intNumPkgs)
    ReDim str26(intNumPkgs)
    
    'Get the fields you wish from the reply transaction
    With frmShip.g_clsParser
        For i = 0 To .TotalFields - 1
            Select Case .Field(i)
                Case "1"
                    f1 = .Data(i)           'TransID
                Case "29"
                    str29(1) = .Data(i)     'First trk number
                Case "35"
                    f35 = .Data(i)          'Total Surcharges
                Case "37"
                    f37 = .Data(i)          'Net Charges
                Case "60"
                    f60 = .Data(i)          'Billed Weight
                Case "116"
                    f116 = .Data(i)         'number Pkgs
            End Select
            
            'Get multiple occurrence tracking numbers
            'Note: This will capture Int'l MPS child trk numbers as well as domestic MPS
            If intNumPkgs > 1 And frmShip.chkDuplicate = 0 Then
                For j = 2 To intNumPkgs
                    If .Field(i) = "29-" & Trim(Str(j)) Then str29(j) = .Data(i)
                Next
            End If
        Next
    End With
    
    'Query to get fields saved in MPS table for MPS transactions
    strMPS = "SELECT * FROM MPS WHERE f1 = '" & f1 & "'"
    'Open recordset
    rsMPS.Open strMPS, g_connFSMSClient, adOpenStatic, adLockBatchOptimistic
    
    'Loop through the MPS recordset and assign the Declared Value fields
    'Note: You can also capture any other MPS field using this loop by declaring
    'variables for those data element assigning the values here.
    i = 1
    If Not rsMPS.EOF Then
        Do Until rsMPS.EOF
            str26(i) = rsMPS!g_str26 & ""
            rsMPS.MoveNext
            i = i + 1
        Loop
    Else
        str26(1) = g_str26
    End If
    
    'Perform Insert query for each package
    For i = 1 To intNumPkgs
        If str29(i) <> "" Then
            strInsert = "INSERT INTO Shipments VALUES(" & SingleQuotes(str29(i)) & ","
            strInsert = strInsert & SingleQuotes(f1) & ","
            strInsert = strInsert & SingleQuotes(FormatCharges(f35)) & ","
            strInsert = strInsert & SingleQuotes(FormatCharges(f37)) & ","
            strInsert = strInsert & SingleQuotes(str26(i)) & ","
            strInsert = strInsert & SingleQuotes(f60) & ","
            strInsert = strInsert & SingleQuotes(f116) & ","
            strInsert = strInsert & "'Shipped')"
            
            m_CN.Execute strInsert
        End If
    Next
    
Release:
    Call Kill
    If rsMPS.State = adStateOpen Then rsMPS.Close
    Set rsMPS = Nothing
    Exit Sub

Handler:
    MsgBox Err.Description, , "modODBC.WriteReply"
    Resume Release
    
End Sub
'---------------------------------------------------------------------------------------
' Procedure : WriteError()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             an FXRS Error reply transaction.
'---------------------------------------------------------------------------------------
'
Public Sub WriteError()
    MsgBox "Shipping Error: " & g_str3, vbCritical, "FSMS Error"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : WriteDelete()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             successful FXRS Delete.
'---------------------------------------------------------------------------------------
'
Public Sub WriteDelete(ByVal strTracking As String)
'Called:    frmShip Parsecomplete event on FSMS 123 reply
'Purpose:   update customer table on void
    On Local Error GoTo Handler
    Dim strUpdate As String
    Dim strUserPwd As String    'DSN user and password seperated by ','
    Dim strUser As String       'DSN user name
    Dim strPwd As String        'DSN user password
    
    If Not Connect Then Exit Sub
    
    strUpdate = "UPDATE Shipments SET [Status] = 'Deleted'" & _
                " WHERE TrkNum = '" & strTracking & "'"
    
    m_CN.Execute strUpdate
    
Release:
   Call Kill
   Exit Sub
Handler:
    MsgBox Err.Description, , "modODBC.WriteDelete"
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Connect()
' DateTime  : 7/5/2004
' Purpose   : Open connection to ODBC test DSN. Instantiate module level recordset.
'---------------------------------------------------------------------------------------
'
Private Function Connect() As Boolean
    On Local Error GoTo Handler
    Dim strDSN As String
    Dim boolSecondTry As Boolean
    
    Set m_CN = New ADODB.Connection
    Set m_RS = New ADODB.Recordset
    
    If m_CN.State <> adStateOpen Then   'if connection is not open then do so
        m_CN.Open "DSN=FSMSClientTest"
    End If
    
    Connect = True
    
    Exit Function

Handler:
    If Not boolSecondTry Then
        boolSecondTry = True
        If Err.number = -2147467259 Then
            Call AddDSN
            Resume
        End If
    End If
    ' MsgBox Err.Description, , "modODBC.Connect"
    Call Kill        'kill connection and recordset

End Function
'---------------------------------------------------------------------------------------
' Procedure : Kill()
' DateTime  : 7/5/2004
' Purpose   : Close connection and recordset objects and set = to nothing.
'---------------------------------------------------------------------------------------
'
Public Sub Kill()
    On Local Error GoTo Handler
    
    If m_CN.State = adStateOpen Then m_CN.Close
    If m_RS.State = adStateOpen Then m_RS.Close
    
    Set m_CN = Nothing      'kill connection
    Set m_RS = Nothing      'kill recordset
    
    Exit Sub
Handler:
    MsgBox Err.Description, , "modODBC.kill"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : AfterClose()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             FXRS Close.
'---------------------------------------------------------------------------------------
'
Public Sub AfterClose()

End Sub
'---------------------------------------------------------------------------------------
' Procedure : BeforeClose()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed before
'             FXRS Close.
'---------------------------------------------------------------------------------------
'
Public Function BeforeClose() As Boolean
    BeforeClose = True
    
End Function

'---------------------------------------------------------------------------------------
' Procedure : BeforeShip()
' DateTime  : 2/21/2005
' Purpose   : REQUIRED Function. Modified to Return Boolean which controls whether or not
'             the shipment will continue or be canceled. Return True to continue shipment,
'             False to cancel.
'---------------------------------------------------------------------------------------
'
'2005-08-24, JFW, Pratt & Whitney And Bombardier Aero required field f1222 pre-assigned tracking number.

Public Function BeforeShip() As Boolean
    ' Pratt and Bombardier
    If frmShip.f1222 <> "" Then
        BeforeShip = True
    Else
        MsgBox "Pre-assigned tracking number is required.", vbApplicationModal + vbExclamation
        BeforeShip = False
    End If
    
    ' B13 warning
    If Left(frmShip.f50, 2) <> "CA" _
    And Left(frmShip.f50, 2) <> "US" _
    And Not boolB13A _
    And frmShip.chkB13A.Value = 0 _
    And frmShip.txtTotCustVal <> "" And CInt(frmShip.txtTotCustVal) >= 2000 Then
        ' B13A warning delivered
        boolB13A = True
        frmShip.chkB13A.Value = 1
        MsgBox "Review B13A requirement.", vbApplicationModal + vbExclamation
        BeforeShip = False
    End If

End Function
'

'---------------------------------------------------------------------------------------
' Procedure : Initialize()
' DateTime  : 7/5/2004
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed on
'             program execution.
'---------------------------------------------------------------------------------------
'
Public Sub Initialize(Optional f1 As Form)

    On Error Resume Next
    
    If Not f1 Is Nothing Then
        If f1.name = "frmShip" Then
            f1.f38.Text = g_clsReg.GetRegistryValue("Carry_f38", "")
            f1.f50.Text = g_clsReg.GetRegistryValue("Carry_f50", "")
            f1.f75.Text = g_clsReg.GetRegistryValue("Carry_f75", "")
            f1.f1274.Text = g_clsReg.GetRegistryValue("Carry_f1274", "")
            frmShip.cboShipmentType = "All TD"
            
            With f1
                .f116.TabIndex = .f25.TabIndex + 1
                .f1670.TabIndex = .f116.TabIndex + 1
                .f1274.TabIndex = .f1670.TabIndex + 1
                .f1273.TabIndex = .f1274.TabIndex + 1
                .cboBoxName.TabIndex = .f1273.TabIndex + 1
                .f59.TabIndex = .cboBoxName.TabIndex + 1
                .f58.TabIndex = .f59.TabIndex + 1
                .f57.TabIndex = .f58.TabIndex + 1
                .f24.TabIndex = .f57.TabIndex + 1
                .f26.TabIndex = .f24.TabIndex + 1
                .f23.TabIndex = .f26.TabIndex + 1
                .f20.TabIndex = .f23.TabIndex + 1
            End With
        End If
        
        ' 2010-06-03, JFW, From Jose, flow of control on frmMPS
        If f1.name = "frmMPS" Then
            f1.cboBoxName.TabIndex = frmMPS.f1670.TabIndex + 1
            f1.cmdAddMPS.TabIndex = frmMPS.cboBoxName.TabIndex + 1
        End If
        
        ' 2010-06-03, JFW, From Jose, flow of control on frmMPS
        If f1.name = "frmCOD" Then
            f1.optCollectType(1).Value = 1
            f1.chkCOD1stPiece.Value = 1
        End If
        
    End If
    Exit Sub

ErrorExit:
    MsgBox Err.Description, vbApplicationModal, "modODBC.Initialize"

End Sub
'---------------------------------------------------------------------------------------
' Procedure : BeforeBatch()
' DateTime  : 20070621-01 Changed BeforeBatch to return a boolean
' Purpose   : REQUIRED SUB. Called before an entire batch is processed.
'---------------------------------------------------------------------------------------
'
Public Function BeforeBatch() As Boolean

    BeforeBatch = True

End Function
'---------------------------------------------------------------------------------------
' Procedure : BeforeBatchShip()
' DateTime  : 8/5/2004
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed on
'             program execution. Called just before a batch transaction is sent to the server.
'---------------------------------------------------------------------------------------
'
Public Function BeforeBatchShip() As Boolean
    BeforeBatchShip = True
End Function

'---------------------------------------------------------------------------------------
' Procedure : AfterBatchShip()
' DateTime  : 10/28/2005
' Purpose   : REQUIRED SUB. Called just after a batch transaction has been processed.
'---------------------------------------------------------------------------------------
'
Public Sub AfterBatchShip()

End Sub
'---------------------------------------------------------------------------------------
' Procedure : AfterBatch()
' DateTime  : 4/6/2005
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             a batch shipment has been completed.
'---------------------------------------------------------------------------------------
'
Public Sub AfterBatch()

End Sub

'---------------------------------------------------------------------------------------
' Procedure : AfterAddrLookup()
' DateTime  : 2/21/2005
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             cboCustID, cboContact, or cboCompany loses focus.
'---------------------------------------------------------------------------------------
'
Public Sub AfterAddrLookup()

End Sub
'---------------------------------------------------------------------------------------
' Procedure : AfterDeptLostFocus()
' DateTime  : 2/21/2005
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             cboDept or f38 loses focus.
'---------------------------------------------------------------------------------------
'
Public Sub AfterDeptLostFocus()

End Sub

' 2012-01-19, JFW, New for UCS.
Public Function AfterScreenChange(f As Form) As Boolean
    If f.name = "frmShip" Then
        f.f26.Enabled = False
    ElseIf f.name = "frmQuote" Then
        f.f26.Enabled = False
    ElseIf f.name = "frmMPS" Then
        f.f26.Enabled = False
    End If
End Function


'---------------------------------------------------------------------------------------
' Procedure : BeforeShipTrans()
' DateTime  : 8/7/2008
' Purpose   : REQUIRED Function. Modified to Return Boolean which controls whether or not
'             the shipment will continue or be canceled. Return True to continue shipment,
'             False to cancel.
'---------------------------------------------------------------------------------------
'
Public Function BeforeShipTrans(ByRef TransString As String) As Boolean
    
    Dim lngMsgBoxResult As VbMsgBoxResult
    BeforeShipTrans = True
    
End Function


'---------------------------------------------------------------------------------------
' Procedure : AfterLostFocus()
' DateTime  : 2007-08-22
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             cboDept or f38 loses focus.
'---------------------------------------------------------------------------------------
'
Public Sub AfterLostFocus(objControl As Control)
        Dim strQuery As String
        Dim rsQuery As ADODB.Recordset
        
        DebugPrint "Test, PreAssign, cboCustID_LostFocus, value " & objControl.name
        
        ' 2005-05-27, JFW, P&W & Bombardier, explicit pre-assigned tracking number
        If objControl.name = "cboCustID" And objControl.Text <> "" And Not g_blnLookup Then
        
            DebugPrint "Test, PreAssign, cboCustID_LostFocus, query"
            
            strQuery = "SELECT f29 FROM PreAssign WHERE f1 = " & SingleQuotes(objControl.Text)
            Set rsQuery = New ADODB.Recordset
            rsQuery.Open strQuery, g_connFSMSClient, adOpenKeyset, adLockOptimistic
            If Not rsQuery.EOF Then
                objControl.f1222.Text = rsQuery!f29
                
                DebugPrint "Test, PreAssign, cboCustID_LostFocus, value " & objControl.f1222.Text
                
                If IsNumeric(objControl.Text) _
                And (Len(objControl.Text) = 12 Or Len(objControl.Text) = 15) Then
                    objControl.Text = ""
                    objControl.SetFocus
                End If
            
            Else
                DebugPrint "Test, PreAssign, " & objControl.name & ", not found"
                
            End If
            rsQuery.Close
        
        Else
            DebugPrint "Test, PreAssign, cboCustID_LostFocus, avoided, lookup test " & CStr(g_blnLookup)
    
        End If
    
    
    
    If objControl.name = "f50" Then
        If Left(objControl.Text, 2) = "CA" Then
            If Left(frmShip.f1090.Text, 3) <> "CAD" Then
                frmShip.f1090 = "CAD"
            End If
            If Left(frmShip.f68.Text, 3) <> "CAD" Then
                frmShip.f68 = "CAD"
            End If
        ' 2009-04-16, JFW, Server is changing reversing USD and CAD
        ElseIf True Then
            If Left(frmShip.f1090.Text, 3) <> "CAD" Then
                frmShip.f1090 = "CAD"
            End If
            If Left(frmShip.f68.Text, 3) <> "USD" Then
                frmShip.f68 = "USD"
            End If
        Else
            If Left(frmShip.f1090.Text, 3) <> "USD" Then
                frmShip.f1090 = "USD"
            End If
            If Left(frmShip.f68.Text, 3) <> "USD" Then
                frmShip.f68 = "USD"
            End If
        End If
    End If
    
End Sub

'---------------------------------------------------------------------------------------
' Procedure : AfterAddrVerifyUpdate()
' DateTime  : 9/13/2005
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             an address has been updated on the Ship form.
'---------------------------------------------------------------------------------------
'
Public Sub AfterAddrVerifyUpdate()
    
End Sub

'---------------------------------------------------------------------------------------
' Procedure : AfterAddrVerify()
' DateTime  : 5/12/2006
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             Address Verification. Three possible status codes are passed. See comments
'             below.
'---------------------------------------------------------------------------------------
'
Public Sub AfterAddrVerify(ByVal intStatusCode As Integer)

    Select Case intStatusCode
        'Address is verfified
        Case 1

        'Soft error
        Case 2

        'Hard error
        Case 3

    End Select

End Sub

' 2007-04-13, JFW, Allow for custom screen display.
Public Sub AfterDisconnect()

    On Error Resume Next
    
End Sub

'---------------------------------------------------------------------------------------
' Procedure : BuildCustomSPLabel()
' DateTime  : 20070620-04
' Purpose   : REQUIRED SUB. Can be used as hook to create custom EPL or ZPL buffer labels
'             for SmartPost.
'---------------------------------------------------------------------------------------
'
Public Function BuildCustomSPLabel(ByVal strLabel As String) As String

    BuildCustomSPLabel = strLabel

End Function
'---------------------------------------------------------------------------------------
' Procedure : AfterRateQuote()
' DateTime  : 20071106-01
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             a rate quote.
'---------------------------------------------------------------------------------------
'
Public Sub AfterRateQuote()

End Sub

'---------------------------------------------------------------------------------------
' Procedure : AfterLocationChange()
' DateTime  : 3/06/2006
' Purpose   : REQUIRED SUB. Can be used as hook to call routines to be executed after
'             the shipping Location has been changed on the Ship form.
'---------------------------------------------------------------------------------------
'
Public Sub AfterLocationChange()

End Sub
'---------------------------------------------------------------------------------------
' Procedure : GetPickupData()
' DateTime  : 1/30/2006
' Purpose   : REQUIRED SUB. Called from frmAddTags.f1_LostFocus, which is the OrderID field.
'             Call routines needed to get data from the customer's system and assign the
'             value to the appropriate fields on the Ship form. This example uses ODBC.
'---------------------------------------------------------------------------------------
'
Public Function GetPickupData(ByVal strKey As String) As Boolean


    GetPickupData = True

End Function

' 2012-01-19, JFW, New for UCS.
Public Function BeforeGotFocus(f As Form, c As Control) As Boolean
    On Error GoTo Test
''    If f.name = "frmShip" Then
''        If c.name = "f26" Then
''            frmShip.f26.Enabled = False
''            frmShip.f26.Text = ""
''        End If
''    End If
    BeforeGotFocus = False
    Exit Function
Test:
    DebugPrint Now & ", " & "BeforeGotFocus" & ", " & Err.Description
    
End Function
' 2011-05-05, JFW, For Scapa
Public Function TDAutoCloseEnabled() As Boolean
    TDAutoCloseEnabled = False
End Function
'

Public Function ClearShipScreen() As Boolean

    On Error Resume Next
    frmShip.f38 = g_clsReg.GetRegistryValue("Carry_f38", "")
    frmShip.f50 = g_clsReg.GetRegistryValue("Carry_f50", "")
    frmShip.f75 = g_clsReg.GetRegistryValue("Carry_f75", "")
    frmShip.f1274 = g_clsReg.GetRegistryValue("Carry_f1274", "")

End Function

Public Function ClearCommodity() As Boolean

End Function

' 2007-04-13, JFW, Allow for custom screen display.
Public Sub AfterConnect()

    ' 2007-12-07, JFW, Large address book making a slow start on some clients.
    ' Call frmShip.ToggleLookup(True)
    On Error Resume Next
    'Call frmShip.ToggleDepartment(True)
    frmShip.f70.ListIndex = 0
    frmShip.f72.ListIndex = 0
    frmShip.f38 = g_clsReg.GetRegistryValue("Carry_f38", "")
    frmShip.f50 = g_clsReg.GetRegistryValue("Carry_f50", "")
    frmShip.f75 = g_clsReg.GetRegistryValue("Carry_f75", "")
    frmShip.f1274 = g_clsReg.GetRegistryValue("Carry_f1274", "")

    Call Initialize(frmShip)
    
End Sub
'
'---------------------------------------------------------------------------------------
' Procedure : WriteBatchEditReply()
' DateTime  : 1/17/2006
' Purpose   : REQUIRED SUB. Called after a successful Batch Error Edit transaction.
'             This is called for both regular and online return labels.
'---------------------------------------------------------------------------------------
'
Public Sub WriteBatchEditReply()

End Sub

'---------------------------------------------------------------------------------------
' Procedure : WriteReturnDelete()
' DateTime  : 7/14/2005
' Purpose   : REQUIRED SUB. Called after a successful return label delete transaction.
'             This is called for both regular and online return labels.
'---------------------------------------------------------------------------------------
'
Public Sub WriteReturnDelete(ByVal strTracking As String)

End Sub
'---------------------------------------------------------------------------------------
' Procedure : AfterLocationChange()
' DateTime  : 5/17/2011
' Purpose   : Remove or add custom services.
' 2011-05-17, JFW, New for Scapa
'---------------------------------------------------------------------------------------
'
Public Sub AfterLoadServices(c1 As ComboBox)
 
End Sub

'---------------------------------------------------------------------------------------
' Procedure : WriteReturnReply()
' DateTime  : 7/14/2005
' Purpose   : REQUIRED SUB. Called after a successful return label transaction.
'             This is called for both regular and online return labels.
'---------------------------------------------------------------------------------------
'
Public Sub WriteReturnReply()

End Sub

'---------------------------------------------------------------------------------------
' Procedure : WriteBOLReply()
' DateTime  : 1/11/2006
' Purpose   : REQUIRED SUB. Called after a successful FedEx Freight BOL transaction.
'             This is called for both regular and online return labels.
'---------------------------------------------------------------------------------------
'
Public Sub WriteBOLReply()

End Sub
' Procedure : WriteTagReply()
' DateTime  : 1/26/2006
' Purpose   : REQUIRED SUB. Called after a successful Call Tag/Express Tag transaction.
'---------------------------------------------------------------------------------------
'
Public Sub WriteTagReply()

End Sub
' Procedure : WriteCancelTagReply()
' DateTime  : 1/26/2006
' Purpose   : REQUIRED SUB. Called after a successful Cancel Call Tag/Express Tag transaction.
'---------------------------------------------------------------------------------------
'
Public Sub WriteCancelTagReply()

End Sub

Public Sub PreAssignTrackingnumber()

End Sub


#End If

